If the initialization fails for some reason, for example by
running 'gnome-shell --replace', we should not crash because
of an attempt of unregistering an unregistered agent handle.
Fix that by checking if the handle is not NULL before calling
the unregistering routines.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/66
if (agent->current_request != NULL)
auth_request_dismiss (agent->current_request);
- polkit_agent_listener_unregister (agent->handle);
- agent->handle = NULL;
+ if (agent->handle)
+ {
+ polkit_agent_listener_unregister (agent->handle);
+ agent->handle = NULL;
+ }
}
static void maybe_process_next_request (ShellPolkitAuthenticationAgent *agent);